/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.boxin.ims.modules.momarketing.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.BaseEntity;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 会员积分Entity
 * @author Jakemanse
 * @version 2013-09-09
 */
@Entity
@Table(name = "ims_coupon_config")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class CouponConfig extends BaseEntity {
	public static final String SOURCE_TYPE_WP = "1"; 	//微信优惠券

	
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private User user; 		// 所属用户
	private String name; 	// 名称
	private String usingType = SOURCE_TYPE_WP;	//使用类型    默认微信0
	private Boolean  repeats;	//是否请允许重复获取优惠券
	private Integer  repeatCount;	//重复获取的次数
	private String keywords;		//对应的关键词
	private Date startTime;	//开始时间
	private Date endTime;	//结束时间
	private Integer validDays;	//有效天数
	private String qrcodeTitle;		//返回二维码时的标题
	private String qrcodeDesc;		//返回二维码的描述
	private Integer memberScore;	//金额
	private Date createTime;	// 创建日期
	
	private String remarks; // 备注
	private String delFlag;	// 删除标记（0：正常；1：删除）
	private String imsIndustryType; //优惠券商家类型    
	
	private String showPic;//优惠券商品的展示图片
	
	private String type;

	public CouponConfig() {
		this.createTime = new Date();
		this.startTime = new Date();
		this.endTime = new Date();
		this.delFlag = DEL_FLAG_NORMAL;
		this.type="0";
	}

	public CouponConfig(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_momarketing_couponConfig")
	//@SequenceGenerator(name = "seq_momarketing_couponConfig", sequenceName = "seq_momarketing_couponConfig")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="user_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@Length(min=1, max=200)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	
	

	public String getUsingType() {
		return usingType;
	}

	public void setUsingType(String usingType) {
		this.usingType = usingType;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Integer getMemberScore() {
		memberScore = (memberScore == null) ? 0 : memberScore; 
		return memberScore;
	}

	public void setMemberScore(Integer memberScore) {
		memberScore = (memberScore == null) ? 0 : memberScore;
		this.memberScore = memberScore;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Length(min=1, max=1)
	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}

	public Integer getValidDays() {
		return validDays;
	}

	public void setValidDays(Integer validDays) {
		this.validDays = validDays;
	}

	public String getQrcodeTitle() {
		return qrcodeTitle;
	}

	public void setQrcodeTitle(String qrcodeTitle) {
		this.qrcodeTitle = qrcodeTitle;
	}

	public String getQrcodeDesc() {
		return qrcodeDesc;
	}

	public void setQrcodeDesc(String qrcodeDesc) {
		this.qrcodeDesc = qrcodeDesc;
	}

	public Boolean getRepeats() {
		return repeats;
	}

	public void setRepeats(Boolean repeats) {
		this.repeats = repeats;
	}

	public Integer getRepeatCount() {
		return repeatCount;
	}

	public void setRepeatCount(Integer repeatCount) {
		this.repeatCount = repeatCount;
	}

	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	public String getImsIndustryType() {
		return imsIndustryType;
	}

	public void setImsIndustryType(String imsIndustryType) {
		this.imsIndustryType = imsIndustryType;
	}

	public String getShowPic() {
		return showPic;
	}

	public void setShowPic(String showPic) {
		this.showPic = showPic;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	
	
	
}


